package com.ibuonline.b2b.common.service;

import java.util.List;
import java.util.Properties;

import org.apache.log4j.Logger;

import com.dimeng.common.base.BaseServiceImpl;
import com.dimeng.common.util.SystemConfig;
import com.ibuonline.b2b.entity.SysProperty;

public class SysPropertyServiceImpl extends BaseServiceImpl<SysProperty> implements SysPropertyService {
	
	private static final Logger logger = Logger.getLogger(SysPropertyService.class);
	
	public void loadSysProperties() {
		logger.info(">>>>>> Loading system properties......");
		List<SysProperty> properties = getAll("propertyType, displayOrder");
		Properties props = SystemConfig.getProperties();
		synchronized (props) {
			for (SysProperty sp : properties) {
				props.setProperty(sp.getPropertyKey(), sp.getPropertyValue());
				
			}
		}
		logger.info(">>>>>> System properties loaded.");
	}
}
